package com.doit.demo02;

import com.doit.demo.Person;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
/*
    泛型:java中的泛型是伪泛型,只在编译时生效,编译后的class文件中并没有泛型
        没有泛型都是Object类型
 */
public class test04 {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        ArrayList<String>list = new ArrayList<>();
        list.add("aaa");

        Class c = list.getClass();
        Method add = c.getMethod("add", Object.class);
        add.invoke(list,234);
        add.invoke(list,4.3);
        add.invoke(list,'a');
        add.invoke(list,true);
        add.invoke(list,new Person());

        System.out.println(list);

        method();
    }
    public static void method(){
        String s = "abcasifabchishfeabcaskufhabc";
        String s1 = s.replaceAll("abc", "");
        int len =(s.length()-s1.length())/3;
        System.out.println(len);

    }
}
